home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / ab20_archive / utilities / emulators / transutils.lzh / start.asm < prev    next >
Assembly Source File  |  1991-01-27  |  1KB  |  72 lines

  1. ;
  2. ;    start.asm  - setup the starting condition of the registers
  3. ;            for AmigaTransformer.
  4. ;
  5. ;
  6. ;    We have the emulator copied into it's final resting position
  7. ;    and now we have to set up some of the registers as the emulator 
  8. ;    expects to find them. 
  9. ;
  10. ;    a3    base of emulator text area    (_text)
  11. ;    a4    base of emulator data area     (_data)
  12. ;    a5    base of MS-DOS user area    (_dos)
  13. ;
  14. ;    d2    amount of data area used for emulator    (_dsize)
  15. ;    d3    amount of text area used for emulator    (_tsize)
  16. ;    d7    size of MS-DOS area            (_dossize)
  17. ;
  18.     xdef    _startup_text
  19.     xdef    _movmem
  20.  
  21.     xref    _text
  22.     xref    _data
  23.     xref    _dos
  24.     xref    _dsize
  25.     xref    _tsize
  26.     xref    _dossize
  27.  
  28. PRIVHNDLRSIZE    equ    $38
  29. INSTALLERSIZE    equ    $10
  30.  
  31.     cseg
  32. _startup_text
  33.     move.l    _text,a3
  34.     move.l    _data,a4
  35.     move.l    _dos,a5
  36.     move.l    _dsize,d2
  37.     move.l    _tsize,d3
  38.     move.l    _dossize,d7
  39.  
  40. ;    We actually start by branching off to the code to install 
  41. ;    the privileged instruction handler.
  42.     jmp    -INSTALLERSIZE(a3)
  43.  
  44. ;
  45. ;    movmem - move memory 
  46. ;
  47. ;    correctly handles overlapped moves
  48. ;
  49. _movmem
  50.     movem.l    4(sp),a0/a1
  51.     move.l    12(sp),d0        ;fetch parameters
  52.     cmp.l    a0,a1            ;see which direction to move
  53.     beq.s    movend            ; or if no move is necessary    
  54.     bls    forward
  55.     add.l    d0,a0            ;move tail to tail
  56.     add.l    d0,a1
  57.  
  58. reverse
  59.     move.b    -(a0),-(a1)
  60.     subq.l    #1,d0
  61.     bne    reverse
  62. movend
  63.     rts
  64. ;
  65. forward                    ;move head to head
  66.     move.b    (a0)+,(a1)+
  67.     subq.l    #1,d0
  68.     bne    forward
  69.     rts
  70.  
  71.     end
  72.